package com.abc.test.common.config;

import com.lyl.common.config.DefaultGlobalExceptionHandler;
import com.lyl.common.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;

/**
 * @author Mr.Luo
 * @date 2022-09-15 17:51
 * @desc
 */
@RestControllerAdvice
public class GlobalExceptionHandler extends DefaultGlobalExceptionHandler {

    @ExceptionHandler({MethodArgumentTypeMismatchException.class})
    public Result<Object> onMethodArgumentTypeMismatchException(MethodArgumentTypeMismatchException e) {
        return Result.build(10003, "方法参数类型不匹配", null);
    }
}
